home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 May / macformat-024.iso / Shareware City / Developers / TurboTCP 2.1 / TCL helper classes / CTCPSessionDoc.h < prev   
Encoding:
Text File  |  1995-01-06  |  2.8 KB  |  91 lines  |  [TEXT/MMCC]

  1. //
  2. // CTCPSessionDoc.h
  3. //
  4. //    TurboTCP library
  5. //    TCP session document
  6. //    TCL-specific class
  7. //
  8. //    Copyright © 1993-95, FrostByte Design / Eric Scouten
  9. //
  10.  
  11. #pragma once
  12.  
  13. #include "TurboTCP.buildflags.h"
  14.  
  15. #if !TurboTCP_TCL
  16.     #error: This file should be used with TCL projects only!
  17. #endif
  18.  
  19. #include "CDocument.h"
  20. #include "CFile.h"
  21. #include "CWindow.h"
  22.  
  23. #include "CTCPEndpoint.h"
  24.  
  25.  
  26. //***********************************************************
  27.  
  28. class CTCPSessionDoc : public CDocument, public CTCPEndpoint {
  29.  
  30. // This abstract class is provided to link the TCL CDocument class with the TurboTCP
  31. // CTCPStream class. View this as a “connection session” document; this is the point at
  32. // which the user interaction with the TCP session is handled.
  33.  
  34. // This class provides all of the necessary behaviors for opening and closing a session.
  35. // It provides abstract methods for receiving data and handling various TCP notifications.
  36. // By default, it sets the window title to the name of the remote host. You may also
  37. // configure it to show the document’s filename, both hostname & filename, or neither.
  38. // (See the fields showFileName and showHostName and the method AutoTitle.
  39.  
  40. // This class does not implement any specific TCP protocol. You will need to subclass it
  41. // to provide the behaviors specific to the protocol you are implementing. You may want
  42. // to examine and use the CTelnetTerminal class in MiniTelnet to see how this may be done.
  43.  
  44. // NOTE: This class is provided only as a convenience. You need not include it in your project.
  45. // It is retained primarily for compatibility with TurboTCP 1.0.
  46.  
  47.  
  48.     TCL_DECLARE_CLASS;
  49.     
  50. public:
  51.     CTCPSessionDoc(unsigned short theDefaultPort,
  52.                         unsigned long recBufferSize = recReceiveSize,
  53.                         unsigned short autoReceiveSize = recAutoRecSize,
  54.                         unsigned short autoReceiveNum = recAutoRecNum,
  55.                         Boolean doUseCName = true,
  56.                         Boolean printable = true)
  57.                         : CDocument(printable),
  58.                           CTCPEndpoint(theDefaultPort, recBufferSize, autoReceiveSize,
  59.                               autoReceiveNum, doUseCName)
  60.                           {}
  61.  
  62.     void                ITCPSessionDoc(CApplication* aSupervisor, Boolean printable)
  63.                         { IDocument(aSupervisor, printable); }        // for compatibility only
  64.  
  65.  
  66.     //
  67.     //    TurboTCP 1.0 NOTE: All of the methods which were in CTCPSessionDoc (OpenUserHost,
  68.     //    Close, etc.) are now inherited from CTCPEndpoint instead.
  69.     //
  70.  
  71.     
  72.     // closing windows & sessions
  73.  
  74.     virtual Boolean    Close(Boolean quitting);
  75.     virtual void        RemoteClose();
  76.  
  77.  
  78.     // window titling
  79.  
  80.     virtual void        SetWindowTitle(Str255 newTitle)
  81.                         { if (itsWindow) itsWindow->SetTitle(newTitle); }
  82.     virtual void        GetFileName(Str255 theName)
  83.                         { if (itsFile) itsFile->GetName(theName); else theName[0] = '\0'; }
  84.  
  85.  
  86.     // CDocument methods which are not implemented here
  87.     
  88.     virtual void        NewFile() {};
  89.     virtual void        OpenFile(SFReply* macSFReply) {};
  90.  
  91. };